/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.entity;

import com.haulmont.chile.core.annotations.MetaProperty;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Author: Sergey42
 * Date: 14.10.13 12:46
 */
@Table(name = "EXT_FACULTY")
@Entity(name = "ext$Faculty")
@NamePattern("%s|fullName")
public class Faculty extends StandardEntity {

    private static final long serialVersionUID = 1437334572074864520L;

    @Column(name = "NAME", length = 100)
    protected String name;

    @Column(name = "NUMBER")
    protected Integer number;

    @MetaProperty
    public String getFullName() {
        return number != null ? "[" + number + "] " + name : name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }
}
